#ifndef RECIPE_H_
#define RECIPE_H_

#include <string>
#include <memory>
using std::string;
using std::shared_ptr;

namespace mtm {
struct Recipe {
	const unsigned chefId;
	const string name;
public:
	/*
	 * Recipe's constructor
	 * arguments:
	 * chefId - the id of the publisher
	 * name - the name of the recipe
	 */
	Recipe(unsigned chefId, const string& name) :
			chefId(chefId), name(name) {
	}
};

/*
 * a compare functor, to use in set<shared_ptr<Recipe>>
 * compares shared_ptr<Recipe> by value (rather than by pointed address)
 */
struct CompareRecipes {
	bool operator()(const Recipe& a, const Recipe& b) const {
		if (a.chefId == b.chefId) {
			return a.name < b.name;
		}
		return a.chefId < b.chefId;
	}
	bool operator()(shared_ptr<Recipe> a, shared_ptr<Recipe> b) const {
		return a && b && (*this)(*a, *b);
	}
};

}

#endif /* RECIPE_H_ */
